package com.esm.serviceimpl;

import java.util.List;

import com.esm.dao.UserDao;
import com.esm.daoimpl.UserDaoImpl;
import com.esm.model.User;
import com.esm.service.UserService;

import net.sf.json.JSONArray;

/**
 * UserServiceImpl
 * 用户服务实现类
 * @author 魏长均
 *
 */
public class UserServiceImpl implements UserService
{
	UserDao udao = new UserDaoImpl();
	public List<User> getEmployees(int rid,int start,int pageSize) 
	{
		return udao.findAllEmployeesMessage(rid,start,pageSize);
	}
	public JSONArray getAllEmployees(int rid, int start, int pageSize) 
	{
		return udao.findAllEmployees(rid, start, pageSize);
	}
	public List<User> getEmployeesByDepid(int rid,int dep_id,int start,int pageSize) 
	{
		return udao.findDeptEmployeesMessage(rid, dep_id,start,pageSize);
	}
	public int getEmpolyeesCount(int rid) 
	{
		return udao.findEmpolyeesCount(rid);
	}
	public int getDeptEmpolyeesCount(int rid, int dep_id) 
	{
		return udao.findDeptEmpolyeesCount(rid, dep_id);
	}
	public boolean addEmployee(User addUser) 
	{
		return udao.insertEmployee(addUser);
	}
	public boolean updateEmployee(int uid,User updateUser) 
	{
		return udao.updateEmployee(uid, updateUser);
	}
	public boolean deleteEmployee(int uid) 
	{
		return udao.deleteEmployee(uid);
	}
	public int getDidByDname(String dname) 
	{
		return udao.findDidByDname(dname);
	}
	public JSONArray getDeptEmployees(int rid, int dep_id, int start, int pageSize) 
	{
		return udao.findDeptEmployees(rid, dep_id, start, pageSize);
	}
	public JSONArray getDempNameByDid(int rid,int dep_id) 
	{
		return udao.findDempName(rid, dep_id);
	}
	public JSONArray getDempName(int rid,int dep_id) 
	{
		return udao.findDempName(rid, dep_id);
	}
	public User getDempByUid(int uid) 
	{
		return udao.findDempByUid(uid);
	}

}
